/**
 * @param {number[]} nums
 * @param {number} n
 * @return {number[]}
*/
var shuffle = function(nums, n) {
  let nums1 = nums.slice(0, nums.length / 2), nums2 = nums.slice(nums.length / 2, nums.length), result = [];
  for(let i = 0; i < nums1.length; i++) {
    result[2 * i] = nums1[i];
  }
  for(let i = 0; i < nums2.length; i++) {
    result[2 * i + 1] = nums2[i];
  }
  return result;
};
let nums = [2,5,1,3,4,7], n = 3;
console.log(shuffle(nums, n));
nums = [1,2,3,4,4,3,2,1], n = 4;
console.log(shuffle(nums, n));
nums = [1,1,2,2], n = 2;
console.log(shuffle(nums, n));
